import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeadPersonVO, DeadPersonForm, DeadPersonQuery } from '@/api/cemetery/deadPerson/types';

/**
 * 查询逝者信息列表
 * @param query
 * @returns {*}
 */

export const listDeadPerson = (query?: DeadPersonQuery): AxiosPromise<DeadPersonVO[]> => {
  return request({
    url: '/cemetery/deadPerson/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询逝者信息详细
 * @param id
 */
export const getDeadPerson = (id: string | number): AxiosPromise<DeadPersonVO> => {
  return request({
    url: '/cemetery/deadPerson/' + id,
    method: 'get'
  });
};

/**
 * 新增逝者信息
 * @param data
 */
export const addDeadPerson = (data: DeadPersonForm) => {
  return request({
    url: '/cemetery/deadPerson',
    method: 'post',
    data: data
  });
};

/**
 * 修改逝者信息
 * @param data
 */
export const updateDeadPerson = (data: DeadPersonForm) => {
  return request({
    url: '/cemetery/deadPerson',
    method: 'put',
    data: data
  });
};

/**
 * 删除逝者信息
 * @param id
 */
export const delDeadPerson = (id: string | number | Array<string | number>) => {
  return request({
    url: '/cemetery/deadPerson/' + id,
    method: 'delete'
  });
};


/**
 * 模板地址
 * @param query
 */
export const getTemplate = (query) => {
  return request({
    url: '/system/dict/data/list',
    method: 'get',
    params: query
  });
};
